package com.maven.trans.demos.service;


import com.maven.trans.demos.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

@Service
public class UserService {
    @Autowired
    UserMapper userMapper;

/*    @Transactional(propagation = Propagation.REQUIRED)
    public Integer register(String userName, String password) {
        Integer result = userMapper.register(userName, password);
        return result;
    }*/

/*
    @Transactional(propagation = Propagation.REQUIRES_NEW)
    public Integer register(String userName, String password) {
        Integer result = userMapper.register(userName, password);
        return result;
    }
*/

/*    @Transactional(propagation = Propagation.NEVER)
    public Integer register(String userName, String password) {
        Integer result = userMapper.register(userName, password);
        return result;
    }*/

    @Transactional(propagation = Propagation.NESTED)
    public Integer register(String userName, String password) {
        Integer result = userMapper.register(userName, password);
        return result;
    }
}
